<template>
    <div class="search">
        <el-form :inline="true" :model="formInline" class="demo-form-inline">
            <el-form-item label="开始时间" prop="date1">
                <el-date-picker type="date" placeholder="选择日期" v-model="formInline.date1" style="width: 100%;"></el-date-picker>
            </el-form-item>
            <el-form-item label="结束时间" prop="date2">
                <el-date-picker type="date" placeholder="选择日期" v-model="formInline.date2" style="width: 100%;"></el-date-picker>
            </el-form-item>
            <el-form-item label="标题" prop="title">
            <el-input v-model="formInline.title"></el-input>
            </el-form-item>
            <el-form-item>
                <el-button type="primary" @click="onSubmit">查询</el-button>
                <el-button type="success" @click="add">添加数据</el-button>
            </el-form-item>
        </el-form>


        <div class="table_data">   

                  <el-table
                    :data="tableData"
                    :border="bflg"
                    style="width: 100%">
                    <el-table-column
                    prop="date"
                    label="日期"
                    width="180">
                    </el-table-column>
                    <el-table-column
                    prop="name"
                    label="姓名"
                    width="180">
                    </el-table-column>
                    <el-table-column
                    prop="address"
                    label="地址">
                    </el-table-column>
                </el-table>
        </div>
        <div class="page">
            <el-pagination
                @size-change="handleSizeChange"
                @current-change="handleCurrentChange"
                :current-page="currentPage4"
                :page-sizes="[10, 50, 100, 200]"
                :page-size="10"
                layout="total, sizes, prev, pager, next, jumper"
                :total="150">
            </el-pagination>

        </div>
        <addovertime :openteg="show"  @update="getProfile"></addovertime>


    </div>
    
</template>

<script>
import addovertime from '@/components/AddOverTime.vue'
export default {
   name:"overtime",
  data() {
      return {
        formInline: {
          user: '',
          region: ''
        },

        bflg:true
        ,
         currentPage4: 4
        ,
         tableData: [{
          date: '2016-05-02',
          name: '王小虎',
          address: '上海市普陀区金沙江路 1518 弄'
        }, {
          date: '2016-05-04',
          name: '王小虎',
          address: '上海市普陀区金沙江路 1517 弄'
        }, {
          date: '2016-05-01',
          name: '王小虎',
          address: '上海市普陀区金沙江路 1519 弄'
        }, {
          date: '2016-05-03',
          name: '王小虎',
          address: '上海市普陀区金沙江路 1516 444弄 '
        }],
        show:false
      }
    },
    methods: {
      onSubmit() {
        console.log('submit!');
      },
       handleSizeChange(val) {
        console.log(`每页 ${val} 条`);
      },
      handleCurrentChange(val) {
        console.log(`当前页: ${val}`);
      },
      add(){
        // console.log(this.show);
          this.show=true;

         console.log(this.show);
      // this.$message({
      //     showClose: true,
      //     message: '恭喜你，这是一条成功消息',
      //     type: 'success'
      //   });
      },
      getProfile(){
        console.log("子组件关闭了")
        this.show=false;
        console.log(12,this.show)
      },
      update(){
        console.log("------------")
      }

    },
    components:{
        addovertime
    }
}
</script>
<style lang="less" scoped>
.search{
    padding: 0 10px;
    height: 100%;
    // background-color: aquamarine;
}
</style>